#!/usr/bin/env bash
[[ -n $(docker ps -aqf ancestor=wurstmeister/zookeeper:latest) ]] && \
[[ -n $(docker rm -f zookeeper) ]]
run_id=$(docker run \
    -d \
    --name zookeeper \
    --restart always \
    -p 2181:2181 \
    -v /etc/localtime:/etc/localtime \
    wurstmeister/zookeeper:latest)
name=$(docker inspect -f "{{.Name}}" zookeeper)
binds=$(docker inspect -f "{{.HostConfig.Binds}}" zookeeper)
echo zookeeper-name: "${name:1}"
echo zookeeper-id: "${run_id:0:12}"
echo zookeeper-binds: "${binds}"
echo "----------------------docker zookeeper running successfully！-----------------------"